
def jisuan_mubiao_malv():
    # 层数1：4320 代表清晰度选择，层数2：30，60 代表 fps 选择，层数3：0 代表无损，1代表高清
    chushi_malv = {4320: {60: {0: 45, 1: 180},
                          30: {0: 30, 1: 120}},
                   2160: {60: {0: 20, 1: 51},
                          30: {0: 13, 1: 34}},
                   1440: {60: {0: 9, 1: 18},
                          30: {0: 6, 1: 13}},
                   1080: {60: {0: 4.5, 1: 9},
                          30: {0: 3, 1: 6}},
                   720: {60: {0: 2.25, 1: 6},
                         30: {0: 1.5, 1: 4}},
                   480: {60: {0: 0.5, 1: 2},
                         30: {0: 0.5, 1: 2}},
                   360: {60: {0: 0.4, 1: 1},
                         30: {0: 0.4, 1: 1}},
                   240: {60: {0: 0.3, 1: 0.7},
                         30: {0: 0.3, 1: 0.7}}
                   }
    daxiao = float(input("请输入视频大小：__ mb (输入数字即可)\n"))
    qingxidu = int(input("请输入视频清晰度的宽：__ p (输入数字即可，例如：4k为 4096*2160，输入2160即可)\n"))
    zhenlv = float(input("请输入视频帧数：__ fps (输入数字即可)\n"))
    shichang = float(input("请输入视频时长：__ s (输入数字即可)\n"))
    yasuoleixing = int(input("请输入压缩类型：0 为无损，1 为原画 (输入数字即可)\n"))
    if zhenlv <= 30:
        zhenlv = 30
    else:
        zhenlv = 60
    jieguo =float((chushi_malv[qingxidu][zhenlv][yasuoleixing] * shichang)/8)
    chazhi = daxiao - jieguo
    if yasuoleixing ==0 :
        print(f"该视频的无损压缩大小预估为：{jieguo}mb,节约空间：{chazhi}mb")
    elif yasuoleixing == 1:
        print(f"该视频的原画压缩大小预估为：{jieguo}mb,节约空间：{chazhi}mb")
    else:
        print("有输入错误，重新开始")



# 按间距中的绿色按钮以运行脚本。
if __name__ == '__main__':
    while True:
        jisuan_mubiao_malv()
        a = int(input("需要结束程序，请输入 9，继续随便输入什么 "))
        if  a == 9:
            break

